import Vue from 'vue'
import VueRouter from 'vue-router'
import {routes as routeList} from "../utils/dynamic"
import baseContainer from "../pages/base-container.vue"
import buttonGroup from "../views/button/button-group"
Vue.use(VueRouter)
// 定义模式
const mode = 'history'
// 定义路由表
const routes = [
    {
        path:'/',
        redirect:'/info-index',
        component:baseContainer,
        children:[
            ...routeList
        ]
    },
    // {
    //     path: "/info-button-group",
    //     name: "button",
    //     component: buttonGroup
    // }

]
console.log(routes)
const router = new VueRouter({
    mode,
    routes
})
// 这里主要是防止触发重复路由错误
router.beforeEach((to, from, next) => {
    console.log(to,from)
    if(to.path === from.path){
        return ;
    }
    next()
})

export default router
